﻿using Owin;
using System.Web.Http;

namespace MsOwin.WebApi2
{
    public class Startup
    {
        public void Configuration(IAppBuilder builder) {

            var config = new HttpConfiguration();
            WebApiRouteConfig(config.Routes);
            //config.Formatters.Remove(config.Formatters.XmlFormatter); //数据返回格式限制为json
            
            //启用webapi中间件
            builder.UseWebApi(config);
        }


        /// <summary>
        /// 配置路由
        /// </summary>
        /// <param name="routes"></param>
        void WebApiRouteConfig(HttpRouteCollection routes) {
            routes.IgnoreRoute("ignore1", "{resource}.axd/{*pathInfo}");
            routes.MapHttpRoute("default.", "api/{controller}/{id}", new { id = RouteParameter.Optional });

        }

    }



}